<!-- 日期组件 -->
<link href="<?php echo FONT_PATH.'static/bootstrap/';?>css/bootstrap-datetimepicker.min.css" rel="stylesheet">
<script src="<?php echo FONT_PATH.'static/bootstrap/';?>js/bootstrap-datetimepicker.js"></script>
<!-- 日期组件 -->
<script type="text/javascript">
    var status = '<?php echo $_GET['status'];?>';
    if(status == '-1'){
        alert('fail:<?php echo $_GET['msg'];?>');
    }
    function on_submits(){
        var mobile = $("#mobile").val();
        var uid = $("#uid").val();
        var nickname = $("#nickname").val();
        var regdate = $("#regdate").val();
        var birth = $("#birth").val();
        var sign = $("#sign").val();
        var avator_id = $("#avator_id").val();
        var sex = $("#sex").val();
        if(!mobile || !nickname || !regdate || !birth){
            alert('手机号、昵称、注册日期、生日不能为空');
            return;
        }
        var url = "index.php?c=user&m=user_update&uid="+uid;
        var param = {"submits":1, "mobile": mobile, "nickname":nickname, "regdate" : regdate, "birth":birth, "sex": sex, "sign": sign, "avator_id": avator_id};
        common_ajax(url, param, function(data){
            if(data.errorCode == 0) {
                window.location.href=  window.location.href;
                return true;
            }else{
                alert(data.errorMsg);
            }
        });

    }
    $("#user_edit").on("hidden.bs.modal", function() {
        $(this).removeData("bs.modal");
    });
</script>
<div class="tab-pane active" id="horizontal-form">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h2 class="modal-title"><?php echo $pageTitle;?></h2>
    </div>

    <form class="form-horizontal" id="admin_edit_form" action="index.php?c=<?php echo $_REQUEST['c'];?>&m=<?php echo $_REQUEST['m'];?>" name="form" method="post">
        <input type="hidden" name="submits" value="1"/>
        <input type="hidden" name="uid" id="uid" value="<?php echo $uid; ?>"/>
        <input type="hidden" name="user['avator_id']" id="avator_id" value="<?php echo $user['avator_id']; ?>"/>
        <div class="form-group" style="margin-top:20px;">
            <label for="nickname" class="col-sm-2 control-label">头像：</label>
            <div class="col-sm-4">
                <a class="" href="index.php?c=imgLib&m=add_img&type=2&id=<?php echo $uid;?>" data-toggle="modal" data-target="#add_img">
                    <img id="img_u_<?php echo $uid;?>" src="<?php echo $user['path']?$user['path']."?x-oss-process=style/scale-cade2":""?>" width="50" border="0" onerror='this.src="<?php echo FONT_UPLOAD_PATH.'/static/images.jpg'?>"'  >
                </a>
            </div>
        </div>

        <div class="form-group" style="margin-top:20px;">
            <label for="mobile" class="col-sm-2 control-label">手机号：</label>
            <div class="col-sm-4">
                <input type="text" name="user[mobile]" id="mobile" value="<?php echo $user["mobile"];?>" class="form-control"/>
            </div>
            <div class="col-sm-2">
                <p class="help-block">不能为空</p>
            </div>
        </div>
        <div class="form-group">
            <label for="nickname" class="col-sm-2 control-label">昵称：</label>
            <div class="col-sm-4">
                <input type="text" name="user[nickname]" id="nickname" value="<?php echo $user["nickname"];?>" class="form-control"/>
            </div>
            <div class="col-sm-2">
                <p class="help-block">不能为空</p>
            </div>
        </div>

        <div class="form-group" style="margin-top:20px;">
            <label for="nickname" class="col-sm-2 control-label">签名：</label>
            <div class="col-sm-4">
                <input type="text" name="user[sign]" id="sign" value="<?php echo $user["sign"];?>" class="form-control"/>
            </div>
            <div class="col-sm-2">
                <p class="help-block">签名</p>
            </div>
        </div>
        <div class="form-group">
            <label for="regdate" class="col-sm-2 control-label">注册日期：</label>

            <div class='col-sm-4 input-group date' id='datetimepicker1' style="float: left;padding-left: 15px;">
                <input type='text' class="form-control" name="user[regdate]" id="regdate" value="<?php echo date("Y-m-d H:i:s", $user["regdate"]);?>"/>
                <span class="input-group-addon">
                    <span class="glyphicon glyphicon-calendar"></span>
                </span>
            </div>
            <div class="col-sm-2">
                <p class="help-block">不能为空</p>
            </div>
        </div>
        <div class="form-group">
            <label for="sex" class="col-sm-2 control-label">性别：</label>
            <div class="col-sm-4">
                <select class="form-control" name="user[sex]" id="sex">
                    <option value="0" <?php echo $user["sex"] == 0 ? "selected" : "";?>>默认</option>
                    <option value="1" <?php echo $user["sex"] == 1 ? "selected" : "";?>>男</option>
                    <option value="2" <?php echo $user["sex"] == 2 ? "selected" : "";?>>女</option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label for="birth" class="col-sm-2 control-label">生日：</label>
            <div class="col-sm-4">
                <input type="date" name="user[birth]" value="<?php echo date("Y-m-d", $user["birth"]);?>" id="birth" class="form-control ng-invalid ng-invalid-required" ng-model="model.date" required="">
            </div>
        </div>


        <div class="modal-footer">
            <button type="reset" class="btn btn-default" data-dismiss="modal">关闭</button>
            <button type="button" onclick="on_submits()" class="btn btn-primary">保存</button>
        </div>

    </form>
    <script type="text/javascript">
        $(function () {
            $('#datetimepicker1').datetimepicker({
                language: 'zh-CN',
                minView: "day",
                format:'yyyy-mm-dd hh:ii:ss',
                initialDate: new Date(),
                autoclose: true,
                todayBtn: true,
            });
        })
    </script>
</div>